The physical meaning of the higher derivatives may not be apparent to you, but their significance and utility will not be soon forgotten after this lesson.
Plot a spline of eû and 1 - 2 xç knotted at {0,1} on an interval including 0. Discuss reasons for the lack of smoothness of the spline curve as it passes through the knot at {0,1}.
:[font = special1; inactive; preserveAspect; ]
Answer:
:[font = input; preserveAspect; ]
Clear[f,g,h,x]
f[x_] = E^x
:[font = input; preserveAspect; ]
g[x_] := 1 - 2 x^2
:[font = input; preserveAspect; ]
h[x_] := g[x]/;x > 0 ; h[x_] := f[x]/;x <= 0
:[font = input; preserveAspect; ]
Plot[h[x],{x,-1,1},AxesLabel->{"x","y"}];
:[font = smalltext; inactive; preserveAspect; ]
To see why the spline has a hitch at the knot at {0,1}, look at:
Plot a spline of eû±å and ¥Òè + £Òû + ¢ÒûÄ + xé/24 knotted at {1,1} on an interval including 1. Discuss reasons for the smoothness of the spline curve as it passes through the knot at {1,1}.
:[font = special1; inactive; preserveAspect; ]
Answer:
:[font = input; preserveAspect; ]
Clear[f,g,h,x]
f[x_] = E^(x - 1)
:[font = input; preserveAspect; ]
g[x_] = 3/8 + x/3 + x^2/4 + x^4/24
:[font = input; preserveAspect; ]
h[x_] := g[x]/;x > 1 ; h[x_] := f[x]/;x <= 1
:[font = input; preserveAspect; ]
Plot[h[x],{x,0,2},AxesLabel->{"x","y"}];
:[font = smalltext; inactive; preserveAspect; ]
To see why the spline passes so smoothly through the knot at {1,1}, look at:
The extreme smoothness of the spline at the knot at {1,1} seems to be related to the fact that f[x] and g[x] have order of contact 4 at {1,1}. A road built in the shape of this plot would be very safe.
First of all, the idea of a spline smooth at its knots makes for interesting plots and nice art. But there is a serious aspect as well.
Laying out the curves on expressways and railroads amounts to joining curved plots to relatively straight plots at knots of a spline. It is unacceptable to have a hitch (corner) in the middle of the roadway.
The higher the order of contact at the knots, the safer the highway or roadbed.
Any order of contact less than 2 is considered unsafe. And this may be pushing it.
If you use your answer to part i) to compute values of eû for
-1 ² x ² 1, then how many accurate decimals of eû do you get?
:[font = special1; inactive; preserveAspect; ]
Answer:
:[font = smalltext; inactive; preserveAspect; ]
Let's see how far apart they are by plotting the absolute value of their difference. We'll use the plotting option PlotRange->All to guarantee that we see the whole plot.
There are seven points in this list. One common belief is that we should pass the unique 6th degree interpolating polynomial through the points and then plot it:
That polynomial curve has dips and crests that are not suggested by the given points. We better give up on using this approach for this list of numbers.
A drastic measure would be to connect the consecutive points with line segments. Some folks call this procedure "linear interpolation." Let's try it:
What is a good way of getting smoothness into this?
:[font = special1; inactive; preserveAspect; ]
Answer:
:[font = smalltext; inactive; preserveAspect; ]
"Freedom is everyone, but using it wisely is the burden of the educated person."
Argentine proverb.
:[font = smalltext; inactive; preserveAspect; ]
Instead of passing a line segment through consecutive points, we pass a different cubic curve through pair of consecutive points and make a smooth spline with knots at each of the points.
This may seem outlandish at first, because a cubic curve
y= a xè + b xç + c x + d
has four coefficients to determine and normally we fit a cubic through four points. We are going to fit the cubic through just two consecutive points and use the extra freedom we have to guarantee smoothness at the knots on the left and right of the knot.
sorted so that the x[k]'s increase as k increases.
:[font = input; preserveAspect; ]
Clear[f,x,y,a,b,c,d,k,eqn]
:[font = smalltext; inactive; preserveAspect; ]
f[k,x] is the cubic that we are going to run from
{x[k], y[k]} to {x[k+1], y[k +1]}:
:[font = input; preserveAspect; ]
f[k_,x_] = a[k] x^3 + b[k] x^2 + c[k] x + d[k]
:[font = smalltext; inactive; preserveAspect; ]
Here k runs from k = 1 to k = 6; so we are working with 6 cubics and each cubic has 4 undetermined (so far) coefficients. This means we have 24 equations to play with.
To hit the points, we want:
f[k, x[k]] = y[k] for k = 1, 2, 3, 4, 5, 6
and
f[k, x[k+1]] = y[k+1] for k = 1, 2, 3, 4, 5, 6.
For smoothness at the knots, we want:
f'[ k, x[k] = f'[ k-1, x[k]] for k = 2, 3, 4, 5, 6
and
f''[ k, x[k]] = f''[ k-1, x[k]] for k = 2, 3, 4, 5, 6
Here all derivatives are with respect to the x variable.
We cannot use k = 1 in the last two equations because there is no function f[0, x].
So far we have specified
6 + 6 + 5 + 5 = 22
conditions and we have 24 undetermined coefficients; as a result we need to specify two more conditions.
Old timers at the art of curve fitting have found that good results usually come from specifying that the second derivatives be 0 at the end points {x[1], y[1]} and {x[7], y[7]}. They call the resulting spline "the natural cubic spline."
Here is the Mathematica code that does all this.
The specific rules we want Mathematica to follow are:
:[font = input; preserveAspect; ]
eqn[1,1] = (f[1,x[1]] == y[1])
:[font = input; preserveAspect; ]
eqn[2,1] = (f[1,x[2]] == y[2])
:[font = input; preserveAspect; ]
eqn[3,1] = (D[f[1,x],{x,2}]/.x->x[1]) == 0
:[font = input; preserveAspect; ]
eqn[4,1] = (D[f[6,x],{x,2}]/.x->x[7]) == 0
:[font = smalltext; inactive; preserveAspect; ]
The general rules we want Mathematica to use are below.
These general rules will not override the specific rules above.
By gosh, that's just about the way that we would have connected the dots with a pencil. The old-time cubic spliners seem to know what they're talking about. And to add adventure to an already thrilling subject, show on the same plot both the interpolating polynomial and the natural spline.
The design of an elecronically-controlled airplane landing system calls for the plane to approach the runway head-on, at a constant horizontal speed s and constant altitude h. As the plane passes over a certain point on the ground R units from the designated touch-down spot on the runway, the system is to take over and bring the plane onto the runway on the trajectory of a cubic polynomial.
The constant horizontal speed s is to be maintained through the whole landing procedure.
Our units will be distances x and y in feet and time t in seconds.
Set up the cubic:
:[font = input; preserveAspect; ]
y = a x^3 + b x^2 + c x + d
:[font = text; inactive; preserveAspect; ]
Here y stands for the altitude of the plane when the plane is directly above a spot on the ground x feet from the designated touch-down spot on the runway. For a smooth onset of the descent we must have:
:[font = input; preserveAspect; ]
eqn1 = (y/.x->R) == h
:[font = input; preserveAspect; ]
eqn2 = (D[y,x]/.x->R) == 0
:[font = text; inactive; preserveAspect; ]
For touchdown at the designated touch-down spot on the runway, we must have:
:[font = input; preserveAspect; ]
eqn3 =(y/.x->0) == 0
:[font = text; inactive; preserveAspect; ]
The runway must be tangent to the trajectory at the designated touch-down spot on the runway, so we must have:
We show our system to a knowledgable aviator for comment. The aviator is skeptical about it because (among other issues) there is no safeguard against destructive forces. In order to hold the plane together, the vertical acceleration must be held to be less than 3.2 ft/sec per sec. Compute the vertical acceleration as a function of the constant horizontal s, R, h and t.
Give the relationship R, s and h must have in order to stay within the safety guideline.
:[font = special1; inactive; preserveAspect; ]
Answer:
:[font = smalltext; inactive; preserveAspect; ]
We know that the plane is travelling at a constant horizontal speed of s ÒòÒ§ÒîÒ«îÒÍð. We also know the trajectory:
:[font = input; preserveAspect; ]
trajectory
:[font = smalltext; inactive; preserveAspect; ]
Because the plane is holding a steady horizontal speed of s mph, we also know that as a function of t,
x = R - s t;
so we can get vertical altitude y (in feet) as a function of t:
:[font = input; preserveAspect; ]
vertalt = trajectory/.x->(R - s t)
:[font = smalltext; inactive; preserveAspect; ]
The vertical speed in feet per second is:
:[font = input; preserveAspect; ]
vertspeed = D[vertalt,t]
:[font = smalltext; inactive; preserveAspect; ]
The vertical acceleration feet per second per second is:
:[font = input; preserveAspect; ]
vertaccel = Together[D[vertspeed,t]]
:[font = smalltext; inactive; preserveAspect; ]
From this we can see that the acceleration starts out at
:[font = input; preserveAspect; ]
vertaccel/.t->0
:[font = smalltext; inactive; preserveAspect; ]
(pointing down) and steadily increases as t increases until the time at which the plane touches down; this time is given by R - s t = 0 or t = R/s, so the vertical acceleration at touchdown is
You are programming a calculator that is being built to deliver seven decimal accuracy. This calculator can only add, subtract, multiply and divide numbers. What polynomial would you program in to stand for Sin[x] for -` ²˚ x ² `?
You are programming a calculator that is being built to deliver seven decimal accuracy. This calculator can only add, subtract, multiply and divide numbers. What polynomial would you program in to stand for Cos[x] for -` ²˚ x ² `?
You are programming a calculator that is being built to deliver seven decimal accuracy. This calculator can only add, subtract, multiply and divide numbers. What polynomial would you program in to stand for eû for -1 ² x ² 1?
G.4) Making your own remarkable plots and approximations - Fourier's sine and cosine waves.
:[font = text; inactive; preserveAspect; ]
Fourier had the idea that all functions defined on [-`,`] can be built from Sine and Cosine waves the same way that all music can be built from basic harmonics.
Design an access road that will take cars off a straight interstate highway onto a Ò¢å mile long straight stretch parallel to the highway running ¥Òå mile from the highway and then bring cars back onto the highway.
This problem refers to Tutorial problem (T.3) (Landing an airplane.)
Our aviator friend had another comment about our electronic landing system.
In the system proposed in Tutorial, there is an implicit jump in the vertical acceleration when x = 0 and x = R. This jump can cause a rather unpleasant jerk similar to the jerk you sometimes feel as a car stops. A way of trying to eliminate it is to make sure that the second derivative
from T.2) above. Pass a cubic spline through them in the manner of T.2) but this time see hat happens when, instead of specifying that the second derivatives be 0 at the end points, you specify the the values to be other numbers. Try positive numbers, negative numbers or mixtures. Can you improve on the plot from T.2)?
Take f[x] = x e±ûÄ and plot on the same axes f[x] and the quadratic (2nd degree) polynomial that has order of contact 2 with f[x] at the point {-1, f[-1]}.
If the plot of quadratic with degree of contact 2 with f[x] at {a, f[a]} opens up, do you expect the tangent line to the graph of f[x] at {a, f[a]} to lie above or below the curve in the vicinity of {a, f[a]}? Illustrate with a plot.
If f[x] and g[x] is any pair of functions that have order of contact n at {0, f[0]} = {0, g[0]}, then what is the order of contact of f[xç] and g[xç] at {0, f[0]} = {0, g[0]}?
If f[x] and g[x] is any pair of functions that have order of contact n at {0, f[0]} = {0, g[0]}, then what is the order of contact of f[xè] and g[xè] at {0, f[0]} = {0, g[0]}?
If p is any positive integer and f[x] and g[x] is any pair of functions that have order of contact n at {0, f[0]} = {0, g[0]}, then what is the order of contact of f[x‚] and g[x‚] at {0, f[0]} = {0, g[0]}?
The higher the order of contact of f[x] and g[x] at 0, then the more we can expect the plots of f[x] and g[x] on [-1,1] to be ——————————————————————.
:[font = text; inactive; preserveAspect; ]
2. What is the basic idea underlying the construction of smooth splines?
:[font = text; inactive; preserveAspect; ]
3. How smooth do you expect a spline of Cos[x] - 1 and x knotted at {0,0} to be?
:[font = text; inactive; preserveAspect; ]
4. How smooth do you expect a spline of Cos[x] - 1 and xç knotted at {0,0} to be?
:[font = text; inactive; preserveAspect; ]
5. Given a constant a, then how would you choose another constant k to try to make a spline of f[x] = Sin[a x] and g[x] = k x knotted at {0,0} as smooth as possible?
:[font = text; inactive; preserveAspect; ]
6. Why are some scientists suspicious of interpolating polynomials but not so suspicious of the natural cubic spline?
:[font = text; inactive; preserveAspect; ]
7. Describe the advantage of a cubic spline over a stick figure.
:[font = text; inactive; preserveAspect; ]
8. Computers and calculators must be programmed to add, subtract, multipy and divide. All the other mathematical operations like takiing logarithms, taking e to a power, taking the Sine of an angle, etc. must be programmed in terms of additions, subtraction, multiplication and division. How can you use the idea of order of contact to help to program these mathematical operations?
:[font = text; inactive; preserveAspect; ]
9. What was Fourier's idea?
:[font = text; inactive; preserveAspect; ]
10. Fix a positive integer n and give a formula for the nth derivative of xü.
:[font = text; inactive; preserveAspect; ]
11. Fix a positive integer n and give a formula for the nth derivative of eû.
:[font = text; inactive; preserveAspect; ]
12. Fix a positive integer n and give a formula for the nth derivative of e±û.
13. Fix a positive integer n and decide whether the nth derivative of Sin[x] has the formula Sin[x + n “Òä].
This would amount to saying that each successive differentiation shifts the Sine curve by “Òä. If this formula is right, then explain why you believe that it is right. If the formula is wrong, then explain why you believe that its wrong.